﻿Public Class PrettyButton
  Private _bitmapNormal As Bitmap = Nothing
  Private _bitmapDown As Bitmap = Nothing
  Private _bitmapActivated As Bitmap = Nothing

  Private _animationTimeMS As Integer = 50

  Private _baseDPI As Integer = 96
  Private _autoScale As Boolean = True

  Private _textOutline As Boolean = True


  Private WithEvents _drawTimer As New Timer()

  Public Sub New()
    InitializeComponent()
    Me._drawTimer.Interval = 5
  End Sub

  Protected Overrides Sub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs)
    ' Do nothing
  End Sub

  Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
    Static backBuff As Bitmap = Nothing
    Dim backGraph As Graphics = Nothing

    If backBuff Is Nothing OrElse backBuff.Width <> ClientSize.Width OrElse backBuff.Height <> ClientSize.Height Then
      backBuff = New Bitmap(ClientSize.Width, ClientSize.Height)
    End If

    backGraph = Graphics.FromImage(backBuff)

    backGraph.Clear(Me.BackColor)



    e.Graphics.DrawImage(backBuff, 0, 0)
    MyBase.OnPaint(e)
  End Sub

  Private Sub DrawTimerOnTick() Handles _drawTimer.Tick
    Me._drawTimer.Enabled = False

  End Sub


End Class
